package leetcode.p255;

import java.util.*;

/**
 * @author: trtan
 * @create: 2021-04-10 20:18
 * @description:
 **/
public class MyStack {

    Deque<Integer> queue = new ArrayDeque<>();
    /** Initialize your data structure here. */
    public MyStack() {
        queue.clear();
    }

    /** Push element x onto stack. */
    public void push(int x) {
        queue.addLast(x);
    }

    /** Removes the element on top of the stack and returns that element. */
    public int pop() {
        return queue.pollLast();
    }

    /** Get the top element. */
    public int top() {
        return queue.peekLast();
    }

    /** Returns whether the stack is empty. */
    public boolean empty() {
        return queue.isEmpty();
    }
}
